package com.aaa.web.controller.secondcar;

import com.aaa.entity.secondcar.NewSecondCar;
import com.aaa.entity.secondcar.SecondCarEntrepotMessage;
import com.aaa.web.commons.Result;
import com.aaa.web.commons.SecondCarEntrepotQuery;
import com.aaa.web.service.secondcarservice.SecondCarEntrepotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
* @program:
* @description: 门店二手车仓库
* @author: 许一鑫
* @create:
**/
@Controller
@RequestMapping("/SecondCarEntrepotController")
public class SecondCarEntrepotController {
    /**
     * 自动注入service
     * */
    @Autowired
    private SecondCarEntrepotService service;
    /**
     * 跳转二手车仓库界面
     * */
    @RequestMapping("/GetSecondCarEntrepotPage")
    public String getSecondCarEntrepotPage(){
        return "views/webhtml/secondcar/secondcarentrepot";
    }
    /**查询出所有在仓库中未卖出的二手车信息*/
    @RequestMapping("/GetSecondCarEntrepotMessage")
    @ResponseBody
    public Map getSecondCarEntrepotMessage(SecondCarEntrepotQuery query){
        Map map=service.getSecondCarEntrepotMessage(query);
        return map;
    }
    /**
     * 查询出二手车仓库中的车辆详细描述
     * */
    @RequestMapping("/GetSecondCarDescribe")
    @ResponseBody
    public String getSecondCarDescribe(SecondCarEntrepotMessage s){
        String desc=service.getSecondCarDescribe(s);
        return desc;
    }
    /**
     * 将二手车仓库中的车辆信息修改为卖出
     * */
        @RequestMapping("/SellSecondCar")
    @ResponseBody
    public Result sellSecondCar(SecondCarEntrepotMessage s){

        return service.sellSecondCar(s);
    }
    //动态获取学校门店下拉框的数据
    @RequestMapping("/Getschool")
    @ResponseBody
    public List<Map> getSchool(){
        return service.getschool();
    }
    /**
     * 动态获取电车型号下拉框的数据
     * */
    @RequestMapping("/Getgoodsname")
    @ResponseBody
    public List<Map> getGoodsname(){
        return service.getgoodsname();
    }
    /**
     * 添加新的二手车仓库信息
     * */
    @RequestMapping("/SetNewSecondCar")
    @ResponseBody
    public Result setNewSecondCar(NewSecondCar n){ return  service.setNewSecondCar(n); }
}
